package com.ktm.gecco.crawler.boche.eventListener;

import com.geccocrawler.gecco.GeccoEngine;
import com.geccocrawler.gecco.listener.EventListener;
import com.ktm.gecco.crawler.boche.entity.BocheCar;
import com.ktm.gecco.crawler.boche.service.impl.BocheCarServiceImpl;
import com.ktm.gecco.crawler.main.entity.UserLog;
import com.ktm.gecco.crawler.main.mapper.EndJobMapper;
import com.ktm.gecco.crawler.main.mapper.UserLogMapper;
import com.ktm.gecco.crawler.main.service.base.BaseUserLog;
import com.ktm.gecco.entity.EndScheduleJob;

/**
 * @desc 类功能描述：
 * @author TKMPC-CW
 * @createTime 2016年8月25日 下午1:33:23
 *
 * @version V2.0
 */
public class BocheCarEventListener extends BaseUserLog  implements EventListener{

    @Override
    public void onStart(GeccoEngine ge) {
        System.out.println("test");
    }

    @Override
    public void onPause(GeccoEngine ge) {
    }

    @Override
    public void onRestart(GeccoEngine ge) {
    }

    @Override
    public void onStop(GeccoEngine ge) {
        System.out.println("博车网车辆数据采集完毕！");

        UserLogMapper logmapper = ctx.getBean(UserLogMapper.class);
        logmapper.saveUserLog(new UserLog("博车网车辆数据采集完毕！ 采集数量为"+(BocheCarServiceImpl.count)+"条！","博车网"));
        EndJobMapper jobmapper = ctx.getBean(EndJobMapper.class);
        jobmapper.addEndJob(new EndScheduleJob(BocheCar.taskName,BocheCar.taskGroup,(BocheCarServiceImpl.count)));

    }

}
